package com.jiangwh.domain.security;

import java.util.ArrayList;

import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

@Component("userDetailsService")
public class SecurityAuthenticationUserDetailService implements
		UserDetailsService {
	

	@Override
	public UserDetails loadUserByUsername(String username)
			throws UsernameNotFoundException {
		ArrayList<SimpleGrantedAuthority> list = new ArrayList<SimpleGrantedAuthority>();
		list.add(new SimpleGrantedAuthority("ROLE_CUSTOMER"));
		User details = new User("rod", "koala", list);
		//CALL WEB SERVICE
		//throw new UsernameNotFoundException("user not found!!!");
		return details;
	}

}
